<template>
  <svg aria-hidden="true" :width="props.width" :height="props.height" :class="props.width?'':'svg-icon'">
    <use class="svg" :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script setup lang="ts">
import { computed } from "vue"

const props = defineProps({
  width: {
    type: String,
  },
  height: {
    type: String,
  },
  prefix: {
    type: String,
    default: "icon",
  },
  name: {
    type: String,
    required: true,
  },
  color: {
    type: String,
  },
})

const symbolId = computed(() => {
  return `#${props.prefix}-${props.name}`
})
</script>

<style >
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>